﻿@model IEnumerable<FCNS.ERP.Models.DefineClass.DefineShopOpen>

@{
    ViewBag.Title = "营业";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script src="~/Scripts/Erp/food.js"></script>
<link href="~/Content/Food/food.css" rel="stylesheet" />

<script type="text/javascript">
    $(document).ready(function () {
        $(".orderStart").click(function () {
            OrderFoodNew($(this).attr("value"), -1);
        });

        $(".orderEnd").click(function () {
                document.location.replace("/Food/OrderEnd/" + $(this).attr("value"));
        });

        $(".orderChange").click(function () {
            var name = prompt('请输入新枱号');
            if (name != null && name != "")
            {
                location.replace("/Food/OrderChangeSeat?oldSeatId=" + $(this).attr("value") + "&newSeatName=" + name);
            }
        });

        $(".orderIO").click(function () {
                document.location.replace("/Food/OrderFoodIO/" + $(this).attr("value"));
        });
    });
</script> 
<table class="table" ng-app="myApp" ng-controller="appCtrl">
    <tr>
        <th>
           枱号分类
        </th>
        <th>
          枱号
        </th>
        <th>
            @Html.DisplayNameFor(model => model.NumberOfPeople)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.RealNumberOfPeople)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Status)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.CategorySeat.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.NumberOfPeople)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.RealNumberOfPeople)
            </td>
            <th> 
                        @Html.DisplayFor(modelItem => item.Status)
            </th>
            <td>
                @{
                    switch (item.Status)
                    {
                        case FCNS.ERP.Models.ErpSeat.EnumSeatStatus.开单:
                        case FCNS.ERP.Models.ErpSeat.EnumSeatStatus.点餐:
                            <label value="@item.Id" class="orderEnd">结单</label>@: | 
                            <label value="@item.Id" class="orderChange">换枱</label>@: | 
                            <label value="@item.Id" class="orderIO">点餐</label>
                            break;

                        case FCNS.ERP.Models.ErpSeat.EnumSeatStatus.空闲:
                            <label value=@item.Id class="orderStart">开单</label>@:
                            break;

                    }
                }
            </td>
        </tr>
                    }
</table>
